<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!--<script src="1.js" type="module"></script>-->
</head>

<body>
    <div></div>
    <script type="module">
        //模块化
        /*
            异步加载
            私密不漏
            重名不怕
            依赖不乱
        */
        //这种方式名字得与导出时的函数名或变量名相同，但是可以用as给函数取别名
        import { test as testA } from './1.js'
        import { test as testB, a } from './2.js'
        console.log(testA, testB, a)

        // * 等价于导入所有
        //import * as obj1 from './1.js'
        //import * as obj2 from './2.js'
        //console.log(obj1, obj2)

    </script>
</body>

</html>